home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Netware Super Library
/
Netware Super Library.iso
/
pegamail
/
pmfxuucp
/
source
/
rfilterc.cpp
< prev
Wrap
C/C++ Source or Header
|
1995-04-12
|
1KB
|
59 lines
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dir.h>
#include <time.h>
void main (int argc, char * argv[] )
{
FILE *outfile;
FILE *infile;
char a[1024];
char to[60]="";
char from[60]="";
int j,i;
char ch;
char filename[20]="";
if (argc<1)
exit(0);
strcpy(filename,argv[1]);
if ((infile = fopen(filename, "r")) == NULL)
{
fprintf(stderr, "Cannot open input file.\n");
exit(0);
}
j=0;
while(((ch=fgetc(infile))!='\n') && !feof(infile))
a[j++]=ch;
a[j]=NULL;
if (a[0]=='F' && a[1]=='r' && a[2]=='o' && a[3]=='m' && a[4]==':' && a[5]==' ')
{
strcpy(&from[0],&a[15]);
}
if (strstr(from,"@")!=0)
strcpy(strstr(from,"@"),"\0");
j=0;
while(((ch=fgetc(infile))!='\n') && !feof(infile))
a[j++]=ch;
a[j]=NULL;
if (a[0]=='T' && a[1]=='o' && a[2]==':' && a[3]==' ')
{
strcpy(&to[0],&a[15]);
}
if (strstr(to,"<")!=0)
{
strcpy(&to[0],strstr(to,"<")+1);
strcpy(strstr(to,">"),"\0");
}
fclose(infile);
if ((outfile = fopen("OUTPUT.bat", "at")) == NULL)
fprintf(stderr, "Cannot open output file.\n");
fprintf(outfile,"call fixwom %s %s %s\n",&from,&filename,&to);
fclose(outfile);
}